package com.yyfax.ph.home.imageupload;

import android.os.Parcel;
import android.os.Parcelable;
import com.yyfax.ph.common.utils.Constants;
import com.yyfax.ph.common.imageselector.bean.ImageBean;

import java.util.ArrayList;

/**
 * 照片上传所需参数
 * Created by laixj on 2017/4/18.
 * Copyright ©2017 www.yylending.com. All Rights Reserved.
 */

public class ImageUploadArguments implements Parcelable {
	/**
	 * 图片所属业务类型
	 */
	public String imageType;
	/**
	 * 已经上传的图片
	 */
	public ArrayList<ImageBean> imageBeans = new ArrayList<>();
	/**
	 * 标题
	 */
	public String title = "上传附件";
	/**
	 * 剩余最大可传照片张数--当限制为两个图片集合的图片总数时传Max-另一个集合已传张数，否则传Max
	 */
	public int remainCount = Constants.MAX_IMAGE_COUNT_DEFAULT;
	/**
	 * 最大可传照片张数
	 */
	public int maxCount = Constants.MAX_IMAGE_COUNT_DEFAULT;

	public ImageUploadArguments() {
	}

	@Override
	public String toString() {
		return "ImageUploadArguments{" +
				", imageType='" + imageType + '\'' +
				", imageBeans=" + imageBeans +
				", title='" + title + '\'' +
				", remainCount=" + remainCount +
				", maxCount=" + maxCount +
				'}';
	}

	@Override
	public int describeContents() {
		return 0;
	}

	@Override
	public void writeToParcel(Parcel dest, int flags) {
		dest.writeString(this.imageType);
		dest.writeTypedList(this.imageBeans);
		dest.writeString(this.title);
		dest.writeInt(this.remainCount);
		dest.writeInt(this.maxCount);
	}

	protected ImageUploadArguments(Parcel in) {
		this.imageType = in.readString();
		this.imageBeans = in.createTypedArrayList(ImageBean.CREATOR);
		this.title = in.readString();
		this.remainCount = in.readInt();
		this.maxCount = in.readInt();
	}

	public static final Creator<ImageUploadArguments> CREATOR = new Creator<ImageUploadArguments>() {
		@Override
		public ImageUploadArguments createFromParcel(Parcel source) {
			return new ImageUploadArguments(source);
		}

		@Override
		public ImageUploadArguments[] newArray(int size) {
			return new ImageUploadArguments[size];
		}
	};
}
